package com.shanghai.market.plshnaghai;

import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;

import com.shanghai.market.plshnaghai.interfaces.IObjectView;
import com.shanghai.market.plshnaghai.login.PhoneRegisteredActivity;
import com.shanghai.market.plshnaghai.login.PhoneVerifyActivity;
import com.shanghai.market.plshnaghai.publics.PublicActivity;

public class MainActivity extends PublicActivity implements View.OnClickListener, IObjectView<String> {

    private ImageView mLogin;
    private ImageView mRegister;
    private ImageView mImageViewClose;

    @Override
    public void initParms() {

    }

    @Override
    public View bindView() {
        View view = LayoutInflater.from(MainActivity.this).inflate(R.layout.activity_main, null);
        return view;
    }

    @Override
    public int bindLayout() {
        return 0;
    }

    @Override
    public void initView(View view) {
        mLogin = (ImageView) view.findViewById(R.id.login);
        mRegister = (ImageView) view.findViewById(R.id.register);
        mImageViewClose = (ImageView) view.findViewById(R.id.close);
    }

    @Override
    public void setListener() {
        mLogin.setOnClickListener(this);
        mRegister.setOnClickListener(this);
        mImageViewClose.setOnClickListener(this);
    }

    @Override
    public void doBusiness(Context mContext) {
        // 加载数据

//        StringModel model = new StringModel(MainActivity.this);
//        model.getData(new String[]{UrlConstants.ALL_AGENCIES});
    }

    @Override
    public void onClick(View v) {
        Intent intent = null;
        switch (v.getId()) {
            case R.id.login:
                intent = new Intent(this, PhoneRegisteredActivity.class);
                startActivity(intent);
                showToast("PhoneRegistered");
                break;
            case R.id.register:
                intent = new Intent(this, PhoneVerifyActivity.class);
                startActivity(intent);
                showToast("PhoneVerify");
                break;
            case R.id.close:
                finish();
                showToast("close");
                break;
            default:
                break;
        }

    }

    @Override
    public void failure(String message) {

    }

    @Override
    public void success(String s) {

    }
}
